// pages/order/order.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
     /**订单页选择的Tab */
     selectedTab: "1",
     /**新订单页签数组 */
     appointmentOrderTabArray: [],
     /**报名订单页签数组 */
     appliedPublicServiceNeedList: [],
     /**接单订单页签数组 */
     receivedOrderTabArray: [],
     /**完成订单页签数组 */
     completeOrderTabArray: [],
     /**新订单数据 */
     appointmentPublicServiceNeedList: [],
     /**样式 */
     appointmentOrderTextClass: "order-grid-item-bottom-select",
     appointmentOrderIconClass: "order-grid-item-icon-select",
     waitOrderTextClass: "order-grid-item-bottom",
     waitOrderIconClass: "",
     receivedOrderTextClass: "order-grid-item-bottom",
     receivedOrderIconClass: "",
     completeOrderTextClass: "order-grid-item-bottom",
     completeOrderIconClass: "",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    let serviceTypeDictList = [
      { value: "UN", text: "*****" },
      { value: "CO", text: "*****" },
      { value: "CA", text: "*******" }
    ];
    let serviceTypeAllItem = [{ value: "ALL", text: "*****" }];
    // 预约
    let appointmentPublicServiceNeedList = [
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
      {
        id: "00001",
        address: "************",
        serviceCategory: "YS",
        serviceCategory_dictText: "********",
        serviceRank_dictText: "*******",
        serviceDays: "*******",
        serviceUnit: "2",
        serviceUnit_dictText: "***",
        adviserTel: "16866866688",
        planStartDate: "20220701",
        registrationStartTime: "20220623",
        registrationEndTime: "20220624",
        status: "********",
        adviserName: "",
      },
    ];
    // 已报名
    let appliedPublicServiceNeedList = [
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
      {
        id: "00001",
        address: "**********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "******",
        serviceDays: "*******",
        serviceUnit_dictText: "******",
        interviewTime: "20220701120000",
        cancelStatus:"",
        cancelStatus_dictText: "",
        recruitStatus: "",
        recruitStatus_dictText: "",
        interviewStatus: "",
        interviewStatus_dictText: "",
        interviewResult: "1",
        interviewResult_dictText: "******",
        adviserName:"*******",
        adviserTel:"*********"
      },
    ];
    // 已接单
    let receivedOrderTabArray = [
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "0",
        workStatus_dictText: "*****",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*****",
        serviceRank_dictText: "*****",
        customerName: "*****",
        contectTel: "********",
        planStartTime: "20220701080000",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "**",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "***"
      },
    ];
    // 已完成
    let completeOrderTabArray = [
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "2",
        workStatus_dictText: "******",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*******",
        serviceRank_dictText: "*****",
        customerName: "*******",
        contectTel: "*******",
        planStartTime: "202207010",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "*******",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "******"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "2",
        workStatus_dictText: "******",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*******",
        serviceRank_dictText: "*****",
        customerName: "*******",
        contectTel: "*******",
        planStartTime: "202207010",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "*******",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "******"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "2",
        workStatus_dictText: "******",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*******",
        serviceRank_dictText: "*****",
        customerName: "*******",
        contectTel: "*******",
        planStartTime: "202207010",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "*******",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "******"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "2",
        workStatus_dictText: "******",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*******",
        serviceRank_dictText: "*****",
        customerName: "*******",
        contectTel: "*******",
        planStartTime: "202207010",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "*******",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "******"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "2",
        workStatus_dictText: "******",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*******",
        serviceRank_dictText: "*****",
        customerName: "*******",
        contectTel: "*******",
        planStartTime: "202207010",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "*******",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "******"
      },
      {
        orderId: "00001",
        serviceId: "",
        dispatchId: "",
        workStatus: "2",
        workStatus_dictText: "******",
        addressDetail: "*********",
        serviceCategory: "YS",
        serviceCategory_dictText: "*******",
        serviceRank_dictText: "*****",
        customerName: "*******",
        contectTel: "*******",
        planStartTime: "202207010",
        planEndTime: "20220701080000",
        actStartTime: "20220701080000",
        actEndTime: "20220728080000",
        serviceDays: "*******",
        serviceCount: "",
        serviceUnit: "2",
        serviceUnit_dictText: "******"
      },
    ];
    this.setData({
      appointmentOrderTabArray: serviceTypeAllItem.concat(serviceTypeDictList),
      appointmentPublicServiceNeedList,
      appliedPublicServiceNeedList,
      receivedOrderTabArray,
      completeOrderTabArray,
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  },
  getAppointmentOrder() {
    this.setData({
      selectedTab: "1",
      appointmentOrderTextClass: "order-grid-item-bottom-select",
      appointmentOrderIconClass: "order-grid-item-icon-select",
      waitOrderTextClass: "order-grid-item-bottom",
      waitOrderIconClass: "",
      receivedOrderTextClass: "order-grid-item-bottom",
      receivedOrderIconClass: "",
      completeOrderTextClass: "order-grid-item-bottom",
      completeOrderIconClass: "",
    });
  },
  /**
   * 获取已报名订单
   */
  getWaitOrder() {
    this.setData({
      selectedTab: "2",
      appointmentOrderTextClass: "order-grid-item-bottom",
      appointmentOrderIconClass: "",
      waitOrderTextClass: "order-grid-item-bottom-select",
      waitOrderIconClass: "order-grid-item-icon-select",
      receivedOrderTextClass: "order-grid-item-bottom",
      receivedOrderIconClass: "",
      completeOrderTextClass: "order-grid-item-bottom",
      completeOrderIconClass: "",
    });
  },
  /**
   * 获取已接单订单
   */
  getReceivedOrder() {
    this.setData({
      selectedTab: "3",
      appointmentOrderTextClass: "order-grid-item-bottom",
      appointmentOrderIconClass: "",
      waitOrderTextClass: "order-grid-item-bottom",
      waitOrderIconClass: "",
      receivedOrderTextClass: "order-grid-item-bottom-select",
      receivedOrderIconClass: "order-grid-item-icon-select",
      completeOrderTextClass: "order-grid-item-bottom",
      completeOrderIconClass: "",
    });
  },
  /**
   * 获取已完成订单
   */
  getCompleteOrder() {
    this.setData({
      selectedTab: "4",
      appointmentOrderTextClass: "order-grid-item-bottom",
      appointmentOrderIconClass: "",
      waitOrderTextClass: "order-grid-item-bottom",
      waitOrderIconClass: "",
      receivedOrderTextClass: "order-grid-item-bottom",
      receivedOrderIconClass: "",
      completeOrderTextClass: "order-grid-item-bottom-select",
      completeOrderIconClass: "order-grid-item-icon-select",
    });
  },

  /**
   * 前往详细画面
   * @param {*} event 点击后画面返回值
   */
  orderDetail(event) {
    let orderId = event.detail.orderDataset.orderId
    let serviceId = event.detail.orderDataset.serviceId
    let dispatchId = event.detail.orderDataset.dispatchId
    wx.navigateTo({
      url: `/pages/order-detail/order-detail?orderId=${orderId}&serviceId=${serviceId}&dispatchId=${dispatchId}&serviceOrderStatus=1`
    })
  },

  /**
   * 前往招募订单详细画面
   * @param {*} event 点击后画面返回值
   */
  needOrderDetail(event) {
    let id = event.detail.orderDataset.id
    wx.navigateTo({
      url: `/pages/order-detail/order-detail?id=${id}&serviceOrderStatus=1`
    })
  },

  /**
   * 不能上户
   * @param {*} event 点击后画面返回值
   */
  orderStop(event) {
    console.log("orderStop", event);
  },

  /**
   * 我要上户
   * @param {*} event 点击后画面返回值
   */
  orderStart(event) {
    console.log("orderStart", event);
  },

  /**
   * 我要下户
   * @param {*} event 点击后画面返回值
   */
  orderEnd(event) {
    console.log("orderEnd", event);
  },

  /**
   * 填写日志
   * @param {*} event 点击后画面返回值
   */
  orderLog(event) {
    console.log("orderLog", event);
  },

  /**
   * 去评价
   * @param {*} event 点击后画面返回值
   */
  orderComment(event) {
    console.log("orderComment", event);
  },
})